{% extends "index.twig" %}
{% set sstring = url_param('q','string' ) %}
{% set advice = 'Use the <span class="desktop-device">sidebar</span><span class="mobile-device">top menu</span> search box to enter a query, or try some tags!' %}
{% block content %}
<div>
<blockquote>{{ search_tooltip }}</blockquote>
</div>
{% if not sstring %}<h4>Please do not use an empty search string.<br />{{ advice|raw }}</h4>
{% else %}
    {# it would be nice if the search weren't repeated for each page...  #}
    {% set sstring = sstring|lower %}
    {% set paging_array = {} %}
    {% for page in tbpages %}
        {% if sstring in page.id|content|striptags|lower or sstring in page.title|striptags|lower or sstring in page.id|lower %}
        {% set paging_array = paging_array|merge([page]) %}
        {% endif %}
    {% endfor %}
    {% set count = paging_array|length %}
    <h4>{{ count }} search results for "{{sstring}}"
    {% if count == 0 %}<br />{{ advice|raw }}{% endif %}</h4>
    {% set paging_url_base = current_page.url ~ '?q=' ~ sstring ~ '&' %}
    {% include 'includes/paging.twig' %}
{% endif %}
{% endblock content %}
